<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>echarts</title>
    <style>
      #charts {
        width: 800px;
        height: 600px;
      }
    </style>
  </head>
  <body>
    <!-- 1. 引入echarts -->
    <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.1.2/echarts.min.js"></script>
    <!-- 2. 准备一个具备宽高的容器 -->
    <div id="charts"></div>

    <script>
      // 3. 获取容器DOM元素
      const cahrts = document.getElementById('cahrts')
      // 4. 调用init方法，生成echarts实例
      const myEcharts = echarts.init(charts)
      // 5. 定义图标option(决定生成怎样的图标)
      option = {
        title: {
          text: '高某人的个人数据'
        },
        legend: {
          top: 'bottom'
        },
        toolbox: {
          show: true,
          feature: {
            mark: { show: true },
            dataView: { show: true, readOnly: false },
            restore: { show: true },
            saveAsImage: { show: true }
          }
        },
        series: [
          {
            name: 'Nightingale Chart',
            type: 'pie',
            radius: [50, 250],
            center: ['50%', '50%'],
            roseType: 'area',
            itemStyle: {
              borderRadius: 8
            },
            data: [
              { value: 40, name: '坑 1' },
              { value: 38, name: '蒙 2' },
              { value: 32, name: '拐 3' },
              { value: 30, name: '骗 4' },
              { value: 28, name: '强奸 5' },
              { value: 26, name: '绑架 6' },
              { value: 22, name: '下毒 7' },
              { value: 18, name: '嫖娼 8' }
            ]
          }
        ]
      }
      // 6. 调用实例的setOption方法渲染图表
      myEcharts.setOption(option)
    </script>
  </body>
</html>
